package com.woyou.ui.activity;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;

import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.citaq.ideliver.R;
import com.squareup.picasso.Picasso;

@EActivity(R.layout.fm_goodsdetails)
public class GoodsDetailsActivity extends BaseActivity {

	@ViewById
	RelativeLayout back;
	@ViewById
	TextView head_title;
	@ViewById
	ImageView fm_goodsdetails_iv;
	private Drawable tu;

	@AfterViews
	public void init() {
		// 初始化数据
		head_title.setText("商品明细");
		Resources res = getResources();
		Bitmap bitmap = BitmapFactory.decodeResource(res, R.raw.tu);
		tu = new BitmapDrawable(res, bitmap);
		loadImageView();
	}
	
	@Override
	public void onResume() {
		super.onResume();
		loadImageView();
	}

	/**
	 * 加载大图片
	 * 
	 * @param url
	 */
	public void loadImageView() {
		String url = getInfoBean().getData().toString();
		fm_goodsdetails_iv.setImageResource(R.raw.tu);
		Picasso.with(mContext).load(url).placeholder(tu).error(tu).into(fm_goodsdetails_iv);
	}


	@Click(R.id.back)
	public void onClick(View v) {
		finish();
	}

	@Override
	public boolean backOperate() {
		return false;
	}
	
	
}
